package com.xuxin.baby.presenter;

import com.xuxin.baby.bean.BaseBean;
import com.xuxin.baby.bean.ReaderVideoBean;
import com.xuxin.baby.contract.ReaderVideoContract;
import com.xuxin.baby.model.ReaderVideoModel;

/**
 * Created by xu_xin
 * Created on 2020/10/23 0023
 * 视频文章
 */
public class ReaderVideoPresenter implements ReaderVideoContract.Presenter {
    private  final ReaderVideoModel model;
    private  final ReaderVideoContract.View view;

    public ReaderVideoPresenter(ReaderVideoContract.View view) {
        this.view = view;
        model = new ReaderVideoModel();
    }

    @Override
    public void getReaderVideo(String tenantId,
                               String token,
                               String categoryId,
                               String keywords,
                               String isRec,
                               String type,
                               String ageRge,
                               int skipCount) {
        if (null != model) {
            model.getReaderVideo(this,
                    tenantId,
                    token,
                    categoryId,
                    keywords,
                    isRec,
                    type,
                    ageRge,
                    skipCount);
        }
    }

    @Override
    public void onSuccess(ReaderVideoBean readerVideoBean) {
        if (null != view) {
            view.onSuccess(readerVideoBean);
        }
    }

    /**
     * 以下内容复用(用于请求完成后的操作)
     */
    @Override
    public void onError(BaseBean baseBean) {
        if (null != view) {
            view.onError(baseBean);
        }
    }

    @Override
    public void onComplete() {
        if (null != view) {
            view.onComplete();
        }
    }
}